package com.victor.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.victor.entity.Shopuser;
//import com.victor.entity.ShopuserLog;
import com.victor.entity.ShopuserXQ;
import com.victor.entity.ShopuserXQphoto;
import com.victor.entity.ShopuserXQyudingsm;

@Mapper
public interface PartnerDao {

	/**
	 * 通过id查询服务伙伴详情
	 * 
	 * @param shopid
	 * @return
	 */
//	@Select({ "select * from shopuser where shopclass=#{shopclass}" })
	List<Shopuser> getList(@Param("shopclass") String shopclass, @Param("starttime") String starttime,
			@Param("endtime") String endtime);

	/**
	 * 通过id查询服务伙伴详情
	 * 
	 * @param shopid
	 * @return
	 */
	Shopuser getXQbyid(@Param("shopid") String shopid);

	/**
	 * 添加操作日志
	 * 
	 * @param shopuserLog
	 */
//	@Insert({ "insert into log (date,time,adminid,content) values (#{date},#{time},#{adminid},#{content})" })
//	int addShopuserLog(Log log);

	/**
	 * 新建服务伙伴
	 * 
	 * @param shopuser
	 * @return
	 */
	@Insert({
			"insert into shopuser (zhucedate,shopname,username,password,flag,sharename,sharelevel,shareprice,sharelocation,sharebeizhu,jianjie,video,shopclass) values (NOW(),#{shopname},#{username},#{password},'0',#{sharename},#{sharelevel},#{shareprice},#{sharelocation},#{sharebeizhu},#{jianjie},#{video},#{shopclass})" })
	int addShopuser(Shopuser shopuser);

	/**
	 * 冻结服务伙伴
	 * 
	 * @param shopuserid
	 * @return
	 */
	@Update({ "update shopuser set flag='1' where id=#{shopuserid}" })
	int frozenShopuser(@Param("shopuserid") String shopuserid);

	/**
	 * 解除冻结服务伙伴
	 * 
	 * @param shopuserid
	 * @return
	 */
	@Update({ "update shopuser set flag='0' where id=#{shopuserid}" })
	int relieveFrozenShopuser(String shopuserid);

	/**
	 * 批量删除服务伙伴
	 * 
	 * @param suids
	 * @return
	 */
	int batchDelete(@Param("suids") int[] suids);

	/**
	 * 查看操作日志
	 * 
	 * @return
	 */
//	@Select({ "select * from shopuser_log order by id desc" })
//	List<ShopuserLog> getShopuserLogs();

	/**
	 * 修改商家信息
	 * 
	 * @param shopuser
	 * @return
	 */
	int updateShopuser(Shopuser shopuser);

	/**
	 * 添加详情返回id
	 * 
	 * @param shopuserxq
	 * @return
	 */
	int addShopuserXQ(ShopuserXQ shopuserxq);

	/**
	 * 添加内容-图片
	 * 
	 * @param shopuserXQphoto
	 * @return
	 */
	@Insert({ "insert into shopuserxqphoto (photo,shopuserxqid) values (#{photo},#{shopuserxqid})" })
	int addShopuserXQphoto(ShopuserXQphoto shopuserXQphoto);

	/**
	 * 添加内容-预定说明
	 * 
	 * @param shopuserXQyudingsm
	 * @return
	 */
	@Insert("insert into shopuserxqyudingsm (yudingsm,shopuserxqid) values (#{yudingsm},#{shopuserxqid})")
	int addShopuserXQyudingsm(ShopuserXQyudingsm shopuserXQyudingsm);

	/**
	 * 删除内容
	 * 
	 * @param shopuserxqid
	 * @return
	 */
	int delContext(@Param("shopuserxqid") String shopuserxqid);

	/**
	 * 删除预定说明
	 * 
	 * @param yudingsmid
	 * @return
	 */
	@Delete({ "delete from shopuserxqyudingsm where id=#{yudingsmid}" })
	int delYudingsm(@Param("yudingsmid") String yudingsmid);

	/**
	 * 修改房间信息
	 * 
	 * @param shopuserxq
	 * @return
	 */
	int updateShopuserXQ(ShopuserXQ shopuserxq);

	/**
	 * 删除原图片
	 * 
	 * @param shopuserxqid
	 * @return
	 */
	@Delete({ "delete from shopuserxqphoto where shopuserxqid=#{shopuserxqid}" })
	int deleteXQphotoByxqid(Integer shopuserxqid);

	/**
	 * 添加新图片
	 * 
	 * @param shopuserXQphoto
	 * @return
	 */
	@Insert({ "insert into shopuserxqphoto (photo,shopuserxqid) values (#{photo},#{shopuserxqid})" })
	int insertXQphoto(ShopuserXQphoto shopuserXQphoto);

}
